<!-- HTML header for doxygen 1.8.13-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>MTB CAT1 Peripheral driver library: Bus Master and PC Functions</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen_style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><a href="http://www.cypress.com/"><img alt="Logo" src="IFXCYP_one-line.png"/></a></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">MTB CAT1 Peripheral driver library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('group__group__prot__functions__busmaster.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">Bus Master and PC Functions<div class="ingroups"><a class="el" href="group__group__prot.html">Prot         (Protection Unit)</a> &raquo; <a class="el" href="group__group__prot__functions.html">Functions</a></div></div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">General Description</h2>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga4b69f79e24b30f22a706e973b05dd079"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__prot__enums.html#ga13ede85383a4afaf5ed3a14b470e38bd">cy_en_prot_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__prot__functions__busmaster.html#ga4b69f79e24b30f22a706e973b05dd079">Cy_Prot_ConfigBusMaster</a> (en_prot_master_t busMaster, bool privileged, bool secure, uint32_t pcMask)</td></tr>
<tr class="memdesc:ga4b69f79e24b30f22a706e973b05dd079"><td class="mdescLeft">&#160;</td><td class="mdescRight">Configures the allowed protection contexts, security (secure/non-secure) and privilege level of the bus transaction created by the specified master.  <a href="#ga4b69f79e24b30f22a706e973b05dd079">More...</a><br /></td></tr>
<tr class="separator:ga4b69f79e24b30f22a706e973b05dd079"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga2d3a54039578a9fae98f6c7b4c4cff41"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__prot__enums.html#ga13ede85383a4afaf5ed3a14b470e38bd">cy_en_prot_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__prot__functions__busmaster.html#ga2d3a54039578a9fae98f6c7b4c4cff41">Cy_Prot_SetActivePC</a> (en_prot_master_t busMaster, uint32_t pc)</td></tr>
<tr class="memdesc:ga2d3a54039578a9fae98f6c7b4c4cff41"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the current/active protection context of the specified bus master.  <a href="#ga2d3a54039578a9fae98f6c7b4c4cff41">More...</a><br /></td></tr>
<tr class="separator:ga2d3a54039578a9fae98f6c7b4c4cff41"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gac6af4217bc8ac5517edb39ebe11e91ec"><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__prot__functions__busmaster.html#gac6af4217bc8ac5517edb39ebe11e91ec">Cy_Prot_GetActivePC</a> (en_prot_master_t busMaster)</td></tr>
<tr class="separator:gac6af4217bc8ac5517edb39ebe11e91ec"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a id="ga4b69f79e24b30f22a706e973b05dd079"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga4b69f79e24b30f22a706e973b05dd079">&#9670;&nbsp;</a></span>Cy_Prot_ConfigBusMaster()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__prot__enums.html#ga13ede85383a4afaf5ed3a14b470e38bd">cy_en_prot_status_t</a> Cy_Prot_ConfigBusMaster </td>
          <td>(</td>
          <td class="paramtype">en_prot_master_t&#160;</td>
          <td class="paramname"><em>busMaster</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>privileged</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>secure</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>pcMask</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Configures the allowed protection contexts, security (secure/non-secure) and privilege level of the bus transaction created by the specified master. </p>
<dl class="section note"><dt>Note</dt><dd>This function is applicable for both CPUSS ver_1 and ver_2.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">busMaster</td><td>Indicates which master needs to be configured. Refer to the CPUSS_MS_ID_X defines in the device config header file.</td></tr>
    <tr><td class="paramname">privileged</td><td>Boolean to define the privilege level of all subsequent bus transfers. True - privileged, False - not privileged. Note that this is an inherited value. If not inherited, then this bit will be used.</td></tr>
    <tr><td class="paramname">secure</td><td>Security setting for the master. True - Secure, False - Not secure.</td></tr>
    <tr><td class="paramname">pcMask</td><td>This is a 16 bit value of the allowed contexts, it is an OR'ed (|) field of the provided defines in cy_prot.h. For example: (CY_PROT_PCMASK1 | CY_PROT_PCMASK3 | CY_PROT_PCMASK4) </td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>The function accepts pcMask values from CY_PROT_PCMASK1 to CY_PROT_PCMASK15. But each device has its own number of available protection contexts. That number is defined by PERI_PC_NR in the config file.</dd></dl>
<dl class="section return"><dt>Returns</dt><dd>Status of the function call.</dd></dl>
<table class="doxtable">
<tr>
<th>Status </th><th>Description  </th></tr>
<tr>
<td>CY_PROT_SUCCESS </td><td>The function completed successfully. </td></tr>
<tr>
<td>CY_PROT_FAILURE </td><td>The resource is locked. </td></tr>
</table>
<dl class="section user"><dt>Function Usage</dt><dd><div class="fragment"><div class="line"></div><div class="line">    <span class="comment">/* Scenario: CM0+ needs to be able to access resources protected with privileged, </span></div><div class="line"><span class="comment">                 secure and set PC value (PC=0, PC=1 or PC=2) access settings */</span></div><div class="line">    </div><div class="line">    <span class="comment">/* Configure the CM0+ bus master - privileged, secure, allow setting PC to PC=1 and PC=2 */</span></div><div class="line">    <span class="keywordflow">if</span>(<a class="code" href="group__group__prot__enums.html#gga13ede85383a4afaf5ed3a14b470e38bda462f07fcb31ed8a07dd273af4290691d">CY_PROT_SUCCESS</a> != <a class="code" href="group__group__prot__functions__busmaster.html#ga4b69f79e24b30f22a706e973b05dd079">Cy_Prot_ConfigBusMaster</a>(CPUSS_MS_ID_CM0, <span class="keyword">true</span>, <span class="keyword">true</span>, <a class="code" href="group__group__prot__enums.html#gga4486bc74d6e98ad99c1ce4d532e48d0fabf25e25bbce833636da932ce78e453e8">CY_PROT_PCMASK1</a> | <a class="code" href="group__group__prot__enums.html#gga4486bc74d6e98ad99c1ce4d532e48d0fa0b17d740a164ae90f06a4ab2f17d79d0">CY_PROT_PCMASK2</a>))</div><div class="line">    {</div><div class="line">        <span class="comment">/* Insert error handling */</span></div><div class="line">    }</div><div class="line"></div></div><!-- fragment --></dd></dl>

</div>
</div>
<a id="ga2d3a54039578a9fae98f6c7b4c4cff41"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga2d3a54039578a9fae98f6c7b4c4cff41">&#9670;&nbsp;</a></span>Cy_Prot_SetActivePC()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__prot__enums.html#ga13ede85383a4afaf5ed3a14b470e38bd">cy_en_prot_status_t</a> Cy_Prot_SetActivePC </td>
          <td>(</td>
          <td class="paramtype">en_prot_master_t&#160;</td>
          <td class="paramname"><em>busMaster</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>pc</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Sets the current/active protection context of the specified bus master. </p>
<p>Allowed PC values are 1-15. If this value is not inherited from another bus master, the value set through this function is used.</p>
<dl class="section note"><dt>Note</dt><dd>This function is applicable for both CPUSS ver_1 and ver_2.</dd>
<dd>
The function does not have access and returns an error for the secure CYB06xx7 devices.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">busMaster</td><td>The bus master to configure. Refer to the CPUSS_MS_ID_X defines in the device config header file.</td></tr>
    <tr><td class="paramname">pc</td><td>Active protection context of the specified master <a class="el" href="group__group__prot__enums.html#ga4467b93f3da4304e584726b975d3faba">cy_en_prot_pc_t</a>. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>that only those protection contexts allowed by the pcMask (which was configured in <a class="el" href="group__group__prot__functions__busmaster.html#ga4b69f79e24b30f22a706e973b05dd079">Cy_Prot_ConfigBusMaster</a>) will take effect. </dd>
<dd>
The function accepts pcMask values from CY_PROT_PC1 to CY_PROT_PC15. But each device has its own number of available protection contexts. That number is defined by PERI_PC_NR in the config file.</dd></dl>
<dl class="section return"><dt>Returns</dt><dd>Status of the function call.</dd></dl>
<table class="doxtable">
<tr>
<th>Status </th><th>Description  </th></tr>
<tr>
<td>CY_PROT_SUCCESS </td><td>The function completed successfully. </td></tr>
<tr>
<td>CY_PROT_FAILURE </td><td>The resource is locked. </td></tr>
</table>
<dl class="section user"><dt>Function Usage</dt><dd><div class="fragment"><div class="line"></div><div class="line">    <span class="comment">/* Scenario: CM0+ needs to access a protected resources that requires PC=1 attribute */</span></div><div class="line">    </div><div class="line">    <span class="comment">/* Configure the bus master to allow setting PC to PC=1 and PC=2 */</span></div><div class="line">     <a class="code" href="group__group__prot__functions__busmaster.html#ga4b69f79e24b30f22a706e973b05dd079">Cy_Prot_ConfigBusMaster</a>(CPUSS_MS_ID_CM0, <span class="keyword">true</span>, <span class="keyword">true</span>, <a class="code" href="group__group__prot__enums.html#gga4486bc74d6e98ad99c1ce4d532e48d0fabf25e25bbce833636da932ce78e453e8">CY_PROT_PCMASK1</a> | <a class="code" href="group__group__prot__enums.html#gga4486bc74d6e98ad99c1ce4d532e48d0fa0b17d740a164ae90f06a4ab2f17d79d0">CY_PROT_PCMASK2</a>);</div><div class="line">    </div><div class="line">    <span class="comment">/* Get the active PC value of CM0+ */</span></div><div class="line">    <span class="keywordflow">if</span>(<a class="code" href="group__group__prot__enums.html#gga4467b93f3da4304e584726b975d3fabaa10dc15f2738ba076ded84cb7b9eac7fa">CY_PROT_PC1</a> != <a class="code" href="group__group__prot__functions__busmaster.html#gac6af4217bc8ac5517edb39ebe11e91ec">Cy_Prot_GetActivePC</a>(CPUSS_MS_ID_CM0))</div><div class="line">    {</div><div class="line">        <span class="comment">/* Set the CM0+ PC value to 1 */</span></div><div class="line">        <span class="keywordflow">if</span>(<a class="code" href="group__group__prot__enums.html#gga13ede85383a4afaf5ed3a14b470e38bda462f07fcb31ed8a07dd273af4290691d">CY_PROT_SUCCESS</a> != <a class="code" href="group__group__prot__functions__busmaster.html#ga2d3a54039578a9fae98f6c7b4c4cff41">Cy_Prot_SetActivePC</a>(CPUSS_MS_ID_CM0, <a class="code" href="group__group__prot__enums.html#gga4467b93f3da4304e584726b975d3fabaa10dc15f2738ba076ded84cb7b9eac7fa">CY_PROT_PC1</a>))</div><div class="line">        {</div><div class="line">            <span class="comment">/* Insert error handling */</span></div><div class="line">        }</div><div class="line">    }</div><div class="line"></div></div><!-- fragment --></dd></dl>

</div>
</div>
<a id="gac6af4217bc8ac5517edb39ebe11e91ec"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gac6af4217bc8ac5517edb39ebe11e91ec">&#9670;&nbsp;</a></span>Cy_Prot_GetActivePC()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint32_t Cy_Prot_GetActivePC </td>
          <td>(</td>
          <td class="paramtype">en_prot_master_t&#160;</td>
          <td class="paramname"><em>busMaster</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<dl class="section note"><dt>Note</dt><dd>This function is applicable for both CPUSS ver_1 and ver_2.</dd></dl>
<p>Returns the active protection context of a master.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">busMaster</td><td>The bus master, whose protection context is being read. Refer to the CPUSS_MS_ID_X defines in the device config header file.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Active protection context of the master <a class="el" href="group__group__prot__enums.html#ga4467b93f3da4304e584726b975d3faba">cy_en_prot_pc_t</a>.</dd></dl>
<dl class="section user"><dt>Function Usage</dt><dd><div class="fragment"><div class="line"></div><div class="line">    <span class="comment">/* Scenario: CM0+ needs to access a protected resources that requires PC=1 attribute */</span></div><div class="line">    </div><div class="line">    <span class="comment">/* Configure the bus master to allow setting PC to PC=1 and PC=2 */</span></div><div class="line">     <a class="code" href="group__group__prot__functions__busmaster.html#ga4b69f79e24b30f22a706e973b05dd079">Cy_Prot_ConfigBusMaster</a>(CPUSS_MS_ID_CM0, <span class="keyword">true</span>, <span class="keyword">true</span>, <a class="code" href="group__group__prot__enums.html#gga4486bc74d6e98ad99c1ce4d532e48d0fabf25e25bbce833636da932ce78e453e8">CY_PROT_PCMASK1</a> | <a class="code" href="group__group__prot__enums.html#gga4486bc74d6e98ad99c1ce4d532e48d0fa0b17d740a164ae90f06a4ab2f17d79d0">CY_PROT_PCMASK2</a>);</div><div class="line">    </div><div class="line">    <span class="comment">/* Get the active PC value of CM0+ */</span></div><div class="line">    <span class="keywordflow">if</span>(<a class="code" href="group__group__prot__enums.html#gga4467b93f3da4304e584726b975d3fabaa10dc15f2738ba076ded84cb7b9eac7fa">CY_PROT_PC1</a> != <a class="code" href="group__group__prot__functions__busmaster.html#gac6af4217bc8ac5517edb39ebe11e91ec">Cy_Prot_GetActivePC</a>(CPUSS_MS_ID_CM0))</div><div class="line">    {</div><div class="line">        <span class="comment">/* Set the CM0+ PC value to 1 */</span></div><div class="line">        <span class="keywordflow">if</span>(<a class="code" href="group__group__prot__enums.html#gga13ede85383a4afaf5ed3a14b470e38bda462f07fcb31ed8a07dd273af4290691d">CY_PROT_SUCCESS</a> != <a class="code" href="group__group__prot__functions__busmaster.html#ga2d3a54039578a9fae98f6c7b4c4cff41">Cy_Prot_SetActivePC</a>(CPUSS_MS_ID_CM0, <a class="code" href="group__group__prot__enums.html#gga4467b93f3da4304e584726b975d3fabaa10dc15f2738ba076ded84cb7b9eac7fa">CY_PROT_PC1</a>))</div><div class="line">        {</div><div class="line">            <span class="comment">/* Insert error handling */</span></div><div class="line">        }</div><div class="line">    }</div><div class="line"></div></div><!-- fragment --></dd></dl>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part
<div id="nav-path" class="navpath">
    <ul>
        <li class="footer">
            Generated for <b>MTB CAT1 Peripheral driver library</b> by <b>Cypress Semiconductor Corporation</b>.
            All rights reserved.
        </li>
    </ul>
</div>
-->
</body>
</html>
